# the minimum version of CMake.
cmake_minimum_required(VERSION 3.5.0)
project(SimpleNapi)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH})

aux_source_directory(${NATIVERENDER_ROOT_PATH} SIMPLE_NAPI_SRCS)

add_library(simple_napi SHARED ${SIMPLE_NAPI_SRCS})
add_library(simple_napi_noexcep SHARED ${SIMPLE_NAPI_SRCS})

if(CMAKE_SYSTEM_NAME STREQUAL "OHOS")
    target_compile_definitions(simple_napi
        PUBLIC USE_HILOG
        PUBLIC OHOS_PLATFORM
    )

    target_compile_definitions(simple_napi_noexcep
        PUBLIC USE_HILOG
        PUBLIC OHOS_PLATFORM
    )
    target_link_libraries(simple_napi PUBLIC libace_napi.z.so libhilog_ndk.z.so)
    target_link_libraries(simple_napi_noexcep PUBLIC libace_napi.z.so libhilog_ndk.z.so)
else()
    target_link_libraries(simple_napi PUBLIC ace_napi)

    target_compile_definitions(simple_napi_noexcep
        PUBLIC ABORT_WITH_FATAL=0
    )
    target_link_libraries(simple_napi_noexcep PUBLIC ace_napi)
endif()